//package com.zzyl.nursing.task;
//
//import com.zzyl.nursing.service.INursingTaskService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.scheduling.annotation.EnableScheduling;
//import org.springframework.scheduling.annotation.Scheduled;
//
//import java.time.LocalDate;
//
///**
// * 任务调度配置类
// */
//@Configuration
//@EnableScheduling
//public class TaskSchedulingConfig {
//
//    @Autowired
//    private INursingTaskService nursingTaskService;
//
//    /**
//     * 每日任务调度 - 每天凌晨1点生成当日任务
//     */
////    @Scheduled(cron = "0 0 1 * * ?")
//    public void scheduleDailyTasks() {
//        nursingTaskService.addNursingTaskByCycle(1, LocalDate.now());
//    }
//
//
//    /**
//     * 每周任务调度 - 每周一凌晨2点生成当周任务
//     */
////    @Scheduled(cron = "0 0 2 ? * MON")
//    public void scheduleWeeklyTasks() {
//        // 获取本周一的日期
//        LocalDate today = LocalDate.now();
//        LocalDate monday = today.minusDays(today.getDayOfWeek().getValue() - 1);
//        nursingTaskService.addNursingTaskByCycle(2, monday);
//    }
//
//    /**
//     * 每月任务调度 - 每月1日凌晨3点生成当月任务
//     */
//    @Scheduled(cron = "0 0 3 1 * ?")
//    public void scheduleMonthlyTasks() {
//        // 获取当月1日的日期
//        LocalDate firstDayOfMonth = LocalDate.now().withDayOfMonth(1);
//        nursingTaskService.addNursingTaskByCycle(3, firstDayOfMonth);
//    }
//}